home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 10 / BBS In A Box Volume X (AMUG) (January 1994).bin / Files / Prog / U-Z / VideoToolBox.cpt / Demos / NoiseVBL.c < prev    next >
MacBinary  |  1993-02-22  |  7.8 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Mon Feb 22 23:07:19 1993, modified Mon Feb 22 23:07:19 1993, creator Think C, type ASCII, 7236 bytes "NoiseVBL.c" , at 0x1cc4 506 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0a 4e 6f 69 73 65 56 | 42 4c 2e 63 00 00 00 00 |..NoiseV|BL.c....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 01 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 1c 44 00 | 00 01 fa a7 af 53 77 a7 |......D.|.....Sw.|
|00000060| af 53 77 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.Sw.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 1c 6b 00 00 |........|.....k..|
|00000080| 2f 2a 0d 4e 6f 69 73 65 | 56 42 4c 2e 63 0d 0d 54 |/*.Noise|VBL.c..T|
|00000090| 68 65 72 65 20 61 72 65 | 20 74 77 6f 20 77 61 79 |here are| two way|
|000000a0| 73 20 74 6f 20 73 79 6e | 63 68 72 6f 6e 69 7a 65 |s to syn|chronize|
|000000b0| 20 79 6f 75 72 20 70 72 | 6f 67 72 61 6d 20 74 6f | your pr|ogram to|
|000000c0| 20 61 20 76 69 64 65 6f | 20 64 69 73 70 6c 61 79 | a video| display|
|000000d0| 2e 20 41 70 70 6c 65 0d | 72 65 63 6f 6d 6d 65 6e |. Apple.|recommen|
|000000e0| 64 73 20 75 73 69 6e 67 | 20 74 68 65 20 76 65 72 |ds using| the ver|
|000000f0| 74 69 63 61 6c 20 62 6c | 61 6e 6b 69 6e 67 20 6c |tical bl|anking l|
|00000100| 65 76 65 6c 20 69 6e 74 | 65 72 72 75 70 74 20 28 |evel int|errupt (|
|00000110| 56 42 4c 29 2e 20 54 68 | 61 74 20 61 70 70 72 6f |VBL). Th|at appro|
|00000120| 61 63 68 20 69 73 0d 69 | 6c 6c 75 73 74 72 61 74 |ach is.i|llustrat|
|00000130| 65 64 20 68 65 72 65 2e | 20 54 68 65 20 6f 74 68 |ed here.| The oth|
|00000140| 65 72 20 61 70 70 72 6f | 61 63 68 2c 20 77 68 69 |er appro|ach, whi|
|00000150| 63 68 20 49 20 6e 6f 72 | 6d 61 6c 6c 79 20 70 72 |ch I nor|mally pr|
|00000160| 65 66 65 72 2c 20 69 73 | 20 74 6f 20 75 73 65 20 |efer, is| to use |
|00000170| 61 20 73 69 64 65 0d 65 | 66 66 65 63 74 20 6f 66 |a side.e|ffect of|
|00000180| 20 6c 6f 61 64 69 6e 67 | 20 74 68 65 20 76 69 64 | loading| the vid|
|00000190| 65 6f 20 63 61 72 64 73 | 20 63 6c 75 74 3a 20 6d |eo cards| clut: m|
|000001a0| 6f 73 74 20 76 69 64 65 | 6f 20 64 72 69 76 65 72 |ost vide|o driver|
|000001b0| 73 20 64 6f 6e 27 74 20 | 72 65 74 75 72 6e 20 75 |s don't |return u|
|000001c0| 6e 74 69 6c 0d 74 68 65 | 20 76 65 72 74 69 63 61 |ntil.the| vertica|
|000001d0| 6c 20 62 6c 61 6e 6b 69 | 6e 67 20 69 6e 74 65 72 |l blanki|ng inter|
|000001e0| 76 61 6c 2e 20 54 68 65 | 20 69 6e 74 65 72 72 75 |val. The| interru|
|000001f0| 70 74 20 61 70 70 72 6f | 61 63 68 20 69 73 20 6d |pt appro|ach is m|
|00000200| 6f 72 65 20 6f 72 20 6c | 65 73 73 0d 67 75 61 72 |ore or l|ess.guar|
|00000210| 61 6e 74 65 65 64 20 74 | 6f 20 77 6f 72 6b 20 6f |anteed t|o work o|
|00000220| 6e 20 61 6c 6c 20 76 69 | 64 65 6f 20 63 61 72 64 |n all vi|deo card|
|00000230| 73 2c 20 73 69 6e 63 65 | 20 41 70 70 6c 65 20 6d |s, since| Apple m|
|00000240| 6f 72 65 20 6f 72 20 6c | 65 73 73 20 72 65 71 75 |ore or l|ess requ|
|00000250| 69 72 65 73 20 74 68 61 | 74 20 69 74 0d 62 65 20 |ires tha|t it.be |
|00000260| 73 75 70 70 6f 72 74 65 | 64 20 62 79 20 61 6c 6c |supporte|d by all|
|00000270| 20 76 69 64 65 6f 20 64 | 72 69 76 65 72 73 2e 20 | video d|rivers. |
|00000280| 49 74 27 73 20 6f 6e 6c | 79 20 64 69 73 61 64 76 |It's onl|y disadv|
|00000290| 61 6e 74 61 67 65 20 69 | 73 20 74 68 61 74 2c 20 |antage i|s that, |
|000002a0| 6f 62 76 69 6f 75 73 6c | 79 2c 0d 69 6e 74 65 72 |obviousl|y,.inter|
|000002b0| 72 75 70 74 73 20 6d 75 | 73 74 20 62 65 20 65 6e |rupts mu|st be en|
|000002c0| 61 62 6c 65 64 2e 20 49 | 20 68 61 76 65 20 74 68 |abled. I| have th|
|000002d0| 65 20 69 6d 70 72 65 73 | 73 69 6f 6e 2c 20 74 68 |e impres|sion, th|
|000002e0| 6f 75 67 68 20 49 20 68 | 61 76 65 6e 27 74 20 63 |ough I h|aven't c|
|000002f0| 6f 6c 6c 65 63 74 65 64 | 0d 68 61 72 64 20 64 61 |ollected|.hard da|
|00000300| 74 61 2c 20 74 68 61 74 | 20 69 6e 74 65 72 72 75 |ta, that| interru|
|00000310| 70 74 73 20 73 74 65 61 | 6c 20 61 20 6c 6f 74 20 |pts stea|l a lot |
|00000320| 6f 66 20 74 69 6d 65 2c | 20 64 65 70 65 6e 64 69 |of time,| dependi|
|00000330| 6e 67 20 6f 6e 20 68 6f | 77 20 62 75 73 79 20 41 |ng on ho|w busy A|
|00000340| 70 70 6c 65 54 61 6c 6b | 2c 0d 74 68 65 20 64 69 |ppleTalk|,.the di|
|00000350| 73 6b 2c 20 53 43 53 49 | 2c 20 6b 65 79 62 6f 61 |sk, SCSI|, keyboa|
|00000360| 72 64 2c 20 6d 6f 75 73 | 65 2c 20 61 6e 64 20 65 |rd, mous|e, and e|
|00000370| 76 65 6e 20 6d 69 73 63 | 65 6c 6c 61 6e 65 6f 75 |ven misc|ellaneou|
|00000380| 73 20 49 4e 49 54 73 20 | 74 68 61 74 20 61 72 65 |s INITs |that are|
|00000390| 20 64 72 69 76 65 6e 20 | 62 79 0d 56 42 4c 20 69 | driven |by.VBL i|
|000003a0| 6e 74 65 72 72 75 70 74 | 73 2e 20 53 6f 20 77 68 |nterrupt|s. So wh|
|000003b0| 65 6e 20 49 20 72 65 61 | 6c 6c 79 20 77 61 6e 74 |en I rea|lly want|
|000003c0| 20 74 6f 20 63 72 61 6e | 6b 2c 20 74 6f 20 64 69 | to cran|k, to di|
|000003d0| 73 70 6c 61 79 20 6d 6f | 76 69 65 73 2c 20 49 20 |splay mo|vies, I |
|000003e0| 70 72 65 66 65 72 20 74 | 6f 0d 75 73 65 20 53 65 |prefer t|o.use Se|
|000003f0| 74 50 72 69 6f 72 69 74 | 79 28 37 29 20 74 6f 20 |tPriorit|y(7) to |
|00000400| 74 65 6d 70 6f 72 61 72 | 69 6c 79 20 73 75 73 70 |temporar|ily susp|
|00000410| 65 6e 64 20 61 6c 6c 20 | 69 6e 74 65 72 72 75 70 |end all |interrup|
|00000420| 74 73 2e 20 49 6e 20 74 | 68 61 74 20 63 61 73 65 |ts. In t|hat case|
|00000430| 20 74 68 65 0d 76 69 64 | 65 6f 2d 64 72 69 76 65 | the.vid|eo-drive|
|00000440| 72 20 73 69 64 65 20 65 | 66 66 65 63 74 20 61 70 |r side e|ffect ap|
|00000450| 70 72 6f 61 63 68 20 69 | 73 20 79 6f 75 72 20 6f |proach i|s your o|
|00000460| 6e 6c 79 20 63 68 6f 69 | 63 65 2e 20 48 6f 77 65 |nly choi|ce. Howe|
|00000470| 76 65 72 2c 20 62 65 20 | 77 61 72 6e 65 64 20 74 |ver, be |warned t|
|00000480| 68 61 74 0d 73 6f 6d 65 | 20 76 69 64 65 6f 20 64 |hat.some| video d|
|00000490| 72 69 76 65 72 73 20 64 | 6f 6e 27 74 20 77 61 69 |rivers d|on't wai|
|000004a0| 74 2c 20 61 6e 64 20 6f | 74 68 65 72 73 20 74 61 |t, and o|thers ta|
|000004b0| 6b 65 20 6d 6f 72 65 20 | 74 68 61 6e 20 61 20 66 |ke more |than a f|
|000004c0| 72 61 6d 65 20 74 6f 20 | 6c 6f 61 64 20 74 68 65 |rame to |load the|
|000004d0| 0d 63 6c 75 74 2c 20 73 | 6f 20 64 6f 20 73 6f 6d |.clut, s|o do som|
|000004e0| 65 20 63 61 72 65 66 75 | 6c 20 74 69 6d 69 6e 67 |e carefu|l timing|
|000004f0| 20 62 65 66 6f 72 65 20 | 79 6f 75 20 72 65 6c 79 | before |you rely|
|00000500| 20 6f 6e 20 69 74 2e 0d | 0d 54 68 69 73 20 70 72 | on it..|.This pr|
|00000510| 6f 67 72 61 6d 20 73 68 | 6f 77 73 20 61 20 6e 6f |ogram sh|ows a no|
|00000520| 69 73 65 20 6d 6f 76 69 | 65 2c 20 61 20 64 79 6e |ise movi|e, a dyn|
|00000530| 61 6d 69 63 20 72 61 6e | 64 6f 6d 20 63 68 65 63 |amic ran|dom chec|
|00000540| 6b 65 72 62 6f 61 72 64 | 2c 20 61 74 20 36 36 2e |kerboard|, at 66.|
|00000550| 37 20 48 7a 21 20 54 68 | 65 0d 6b 65 79 20 72 6f |7 Hz! Th|e.key ro|
|00000560| 75 74 69 6e 65 2c 20 77 | 68 69 63 68 20 73 68 6f |utine, w|hich sho|
|00000570| 77 73 20 65 61 63 68 20 | 66 72 61 6d 65 2c 20 69 |ws each |frame, i|
|00000580| 73 20 69 6e 20 74 68 65 | 20 66 69 6c 65 20 43 6f |s in the| file Co|
|00000590| 70 79 42 69 74 73 51 75 | 69 63 6b 6c 79 2e 63 20 |pyBitsQu|ickly.c |
|000005a0| 46 6f 72 20 62 65 73 74 | 0d 72 65 73 75 6c 74 73 |For best|.results|
|000005b0| 20 79 6f 75 20 73 68 6f | 75 6c 64 20 61 6c 6c 6f | you sho|uld allo|
|000005c0| 63 61 74 65 20 6c 6f 74 | 73 20 6f 66 20 6d 65 6d |cate lot|s of mem|
|000005d0| 6f 72 79 20 74 6f 20 74 | 68 69 73 20 70 72 6f 67 |ory to t|his prog|
|000005e0| 72 61 6d 2c 20 65 2e 67 | 2e 20 33 4d 42 2e 20 49 |ram, e.g|. 3MB. I|
|000005f0| 74 0d 70 72 65 2d 63 6f | 6d 70 75 74 65 73 20 61 |t.pre-co|mputes a|
|00000600| 73 20 6d 61 6e 79 20 6e | 6f 69 73 65 20 66 72 61 |s many n|oise fra|
|00000610| 6d 65 73 20 61 73 20 73 | 70 61 63 65 20 61 6c 6c |mes as s|pace all|
|00000620| 6f 77 73 2e 20 41 66 74 | 65 72 20 73 68 6f 77 69 |ows. Aft|er showi|
|00000630| 6e 67 20 65 61 63 68 20 | 66 72 61 6d 65 20 6f 6e |ng each |frame on|
|00000640| 63 65 0d 69 74 20 63 79 | 63 6c 65 73 20 74 68 72 |ce.it cy|cles thr|
|00000650| 6f 75 67 68 20 74 68 65 | 6d 20 61 67 61 69 6e 2e |ough the|m again.|
|00000660| 20 54 68 75 73 20 74 6f | 20 67 65 74 20 61 20 74 | Thus to| get a t|
|00000670| 72 75 65 20 69 6d 70 72 | 65 73 73 69 6f 6e 20 6f |rue impr|ession o|
|00000680| 66 20 77 68 69 74 65 20 | 6e 6f 69 73 65 20 79 6f |f white |noise yo|
|00000690| 75 0d 6e 65 65 64 20 74 | 6f 20 63 6f 6d 70 75 74 |u.need t|o comput|
|000006a0| 65 20 6c 6f 74 73 20 6f | 66 20 6e 6f 69 73 65 20 |e lots o|f noise |
|000006b0| 66 72 61 6d 65 73 2c 20 | 65 2e 67 2e 20 31 30 30 |frames, |e.g. 100|
|000006c0| 2e 20 54 68 69 73 20 6d | 61 79 20 72 65 71 75 69 |. This m|ay requi|
|000006d0| 72 65 20 73 65 76 65 72 | 61 6c 0d 6d 65 67 61 62 |re sever|al.megab|
|000006e0| 79 74 65 73 2c 20 64 65 | 70 65 6e 64 69 6e 67 20 |ytes, de|pending |
|000006f0| 77 68 61 74 20 79 6f 75 | 72 20 73 63 72 65 65 6e |what you|r screen|
|00000700| 27 73 20 70 69 78 65 6c | 20 64 65 70 74 68 20 69 |'s pixel| depth i|
|00000710| 73 20 73 65 74 20 74 6f | 2e 0d 0d 48 49 53 54 4f |s set to|...HISTO|
|00000720| 52 59 3a 0d 31 31 2f 32 | 33 2f 38 38 20 44 65 6e |RY:.11/2|3/88 Den|
|00000730| 69 73 20 50 65 6c 6c 69 | 20 77 72 6f 74 65 20 69 |is Pelli| wrote i|
|00000740| 74 2e 0d 0d 34 2f 32 30 | 2f 39 31 20 49 20 75 70 |t...4/20|/91 I up|
|00000750| 64 61 74 65 64 20 74 68 | 69 73 2e 20 49 74 20 6e |dated th|is. It n|
|00000760| 6f 77 20 68 61 73 20 65 | 73 73 65 6e 74 69 61 6c |ow has e|ssential|
|00000770| 6c 79 20 6e 6f 20 68 61 | 72 64 77 61 72 65 20 64 |ly no ha|rdware d|
|00000780| 65 70 65 6e 64 65 6e 63 | 69 65 73 2e 20 49 74 20 |ependenc|ies. It |
|00000790| 64 6f 65 73 0d 72 65 71 | 75 69 72 65 20 74 68 61 |does.req|uire tha|
|000007a0| 74 20 74 68 65 20 76 69 | 64 65 6f 20 62 65 20 69 |t the vi|deo be i|
|000007b0| 6e 20 61 20 73 6c 6f 74 | 2c 20 73 69 6e 63 65 20 |n a slot|, since |
|000007c0| 69 74 20 75 73 65 73 20 | 73 6c 6f 74 20 69 6e 74 |it uses |slot int|
|000007d0| 65 72 72 75 70 74 73 2e | 20 41 20 62 61 73 69 63 |errupts.| A basic|
|000007e0| 0d 70 72 6f 62 6c 65 6d | 20 77 69 74 68 20 74 68 |.problem| with th|
|000007f0| 65 20 73 63 68 65 6d 65 | 20 69 73 20 74 68 61 74 |e scheme| is that|
|00000800| 20 69 6e 74 65 72 72 75 | 70 74 73 20 73 65 65 6d | interru|pts seem|
|00000810| 20 74 6f 20 62 65 20 73 | 68 75 74 20 6f 75 74 20 | to be s|hut out |
|00000820| 77 68 69 6c 65 20 74 68 | 65 0d 69 6e 74 65 72 72 |while th|e.interr|
|00000830| 75 70 74 20 73 65 72 76 | 69 63 65 20 72 6f 75 74 |upt serv|ice rout|
|00000840| 69 6e 65 73 20 61 72 65 | 20 72 75 6e 6e 69 6e 67 |ines are| running|
|00000850| 2e 20 41 73 20 61 20 72 | 65 73 75 6c 74 20 74 68 |. As a r|esult th|
|00000860| 65 20 74 69 6d 69 6e 67 | 20 69 6e 66 6f 72 6d 61 |e timing| informa|
|00000870| 74 69 6f 6e 20 69 73 0d | 69 6e 61 63 63 75 72 61 |tion is.|inaccura|
|00000880| 74 65 20 73 69 6e 63 65 | 20 6d 61 6e 79 20 31 20 |te since| many 1 |
|00000890| 6d 73 20 69 6e 74 65 72 | 72 75 70 74 73 20 61 72 |ms inter|rupts ar|
|000008a0| 65 20 6c 6f 73 74 20 64 | 75 72 69 6e 67 20 74 68 |e lost d|uring th|
|000008b0| 65 20 63 61 6c 6c 20 74 | 6f 0d 43 6f 70 79 42 69 |e call t|o.CopyBi|
|000008c0| 74 73 51 75 69 63 6b 6c | 79 28 29 2e 20 49 20 74 |tsQuickl|y(). I t|
|000008d0| 68 69 6e 6b 20 74 68 65 | 20 6f 6e 6c 79 20 73 6f |hink the| only so|
|000008e0| 6c 75 74 69 6f 6e 20 74 | 6f 20 74 68 69 73 20 77 |lution t|o this w|
|000008f0| 6f 75 6c 64 20 62 65 20 | 74 6f 20 70 75 74 20 74 |ould be |to put t|
|00000900| 68 65 20 74 69 6d 65 0d | 63 6f 6e 73 75 6d 69 6e |he time.|consumin|
|00000910| 67 20 63 61 6c 6c 20 74 | 6f 20 43 6f 70 79 42 69 |g call t|o CopyBi|
|00000920| 74 73 51 75 69 63 6b 6c | 79 20 62 61 63 6b 20 69 |tsQuickl|y back i|
|00000930| 6e 20 74 68 65 20 6d 61 | 69 6e 20 70 72 6f 67 72 |n the ma|in progr|
|00000940| 61 6d 2c 20 77 61 69 74 | 69 6e 67 20 66 6f 72 20 |am, wait|ing for |
|00000950| 74 68 65 0d 69 6e 74 65 | 72 72 75 70 74 20 73 65 |the.inte|rrupt se|
|00000960| 72 76 69 63 65 20 72 6f | 75 74 69 6e 65 20 74 6f |rvice ro|utine to|
|00000970| 20 67 69 76 65 20 69 74 | 20 70 65 72 6d 69 73 73 | give it| permiss|
|00000980| 69 6f 6e 20 74 6f 20 73 | 74 61 72 74 20 65 61 63 |ion to s|tart eac|
|00000990| 68 20 6e 65 77 20 66 72 | 61 6d 65 2e 0d 0d 34 2f |h new fr|ame...4/|
|000009a0| 31 35 2f 39 32 20 52 65 | 6d 6f 76 65 64 20 61 6c |15/92 Re|moved al|
|000009b0| 6c 20 62 75 67 73 20 61 | 6e 64 20 75 70 64 61 74 |l bugs a|nd updat|
|000009c0| 65 64 20 74 6f 20 77 6f | 72 6b 20 77 69 74 68 20 |ed to wo|rk with |
|000009d0| 54 48 49 4e 4b 20 43 20 | 35 2e 20 4e 6f 77 20 70 |THINK C |5. Now p|
|000009e0| 72 6f 70 65 72 6c 79 20 | 73 65 74 20 41 35 0d 69 |roperly |set A5.i|
|000009f0| 6e 20 74 68 65 20 69 6e | 74 65 72 72 75 70 74 20 |n the in|terrupt |
|00000a00| 73 65 72 76 69 63 65 20 | 72 6f 75 74 69 6e 65 73 |service |routines|
|00000a10| 2c 20 75 73 69 6e 67 20 | 74 68 65 20 6d 65 74 68 |, using |the meth|
|00000a20| 6f 64 20 73 75 67 67 65 | 73 74 65 64 20 69 6e 20 |od sugge|sted in |
|00000a30| 54 65 63 68 20 4e 6f 74 | 65 20 31 38 30 2e 0d 49 |Tech Not|e 180..I|
|00000a40| 20 72 65 6d 6f 76 65 64 | 20 74 68 65 20 6f 6c 64 | removed| the old|
|00000a50| 20 61 74 74 65 6d 70 74 | 20 74 6f 20 64 69 73 61 | attempt| to disa|
|00000a60| 62 6c 65 20 41 70 70 6c | 65 54 61 6c 6b 2c 20 77 |ble Appl|eTalk, w|
|00000a70| 68 69 63 68 20 6e 6f 77 | 20 73 65 65 6d 73 20 74 |hich now| seems t|
|00000a80| 6f 20 68 61 6e 67 20 75 | 70 20 77 68 65 6e 0d 69 |o hang u|p when.i|
|00000a90| 74 20 61 74 74 65 6d 70 | 74 73 20 74 6f 20 72 65 |t attemp|ts to re|
|00000aa0| 65 6e 61 62 6c 65 20 41 | 70 70 6c 65 54 61 6c 6b |enable A|ppleTalk|
|00000ab0| 2e 20 49 20 61 6c 73 6f | 20 72 65 6d 6f 76 65 64 |. I also| removed|
|00000ac0| 20 74 68 65 20 63 6c 75 | 74 20 6d 61 6e 69 70 75 | the clu|t manipu|
|00000ad0| 6c 61 74 69 6f 6e 73 2e | 0d 0d 34 2f 31 36 2f 39 |lations.|..4/16/9|
|00000ae0| 32 09 50 75 74 20 74 68 | 65 20 6e 6f 69 73 65 20 |2.Put th|e noise |
|00000af0| 69 6e 20 69 74 73 20 6f | 77 6e 20 77 69 6e 64 6f |in its o|wn windo|
|00000b00| 77 2e 20 52 75 6e 20 65 | 73 73 65 6e 74 69 61 6c |w. Run e|ssential|
|00000b10| 6c 79 20 63 6f 6e 74 69 | 6e 75 6f 75 73 6c 79 20 |ly conti|nuously |
|00000b20| 75 6e 74 69 6c 0d 75 73 | 65 72 20 71 75 69 74 73 |until.us|er quits|
|00000b30| 2e 0d 0d 38 2f 31 39 2f | 39 32 20 52 65 70 6c 61 |...8/19/|92 Repla|
|00000b40| 63 65 64 20 6f 62 73 6f | 6c 65 74 65 20 54 69 6d |ced obso|lete Tim|
|00000b50| 65 49 74 2e 63 20 62 79 | 20 6e 65 77 20 54 69 6d |eIt.c by| new Tim|
|00000b60| 65 72 2e 63 2e 20 54 69 | 6d 69 6e 67 20 73 65 65 |er.c. Ti|ming see|
|00000b70| 6d 73 20 74 6f 20 62 65 | 20 66 69 6e 65 20 6e 6f |ms to be| fine no|
|00000b80| 77 2e 0d 0d 38 2f 32 32 | 2f 39 32 20 64 67 70 20 |w...8/22|/92 dgp |
|00000b90| 4d 6f 76 65 64 20 6d 6f | 73 74 20 6f 66 20 74 68 |Moved mo|st of th|
|00000ba0| 65 20 69 6e 74 65 72 72 | 75 70 74 20 73 65 72 76 |e interr|upt serv|
|00000bb0| 69 63 65 20 72 6f 75 74 | 69 6e 65 20 63 6f 64 65 |ice rout|ine code|
|00000bc0| 20 74 6f 20 0d 56 42 4c | 49 6e 74 65 72 72 75 70 | to .VBL|Interrup|
|00000bd0| 74 53 65 72 76 69 63 65 | 52 6f 75 74 69 6e 65 2e |tService|Routine.|
|00000be0| 63 2e 20 4a 75 73 74 20 | 66 6f 72 20 66 75 6e 2c |c. Just |for fun,|
|00000bf0| 20 49 20 6d 61 64 65 20 | 74 68 65 20 70 72 6f 67 | I made |the prog|
|00000c00| 72 61 6d 20 75 73 65 20 | 61 6e 20 61 6c 74 65 72 |ram use |an alter|
|00000c10| 6e 61 74 65 20 6d 6f 6e | 69 74 6f 72 2c 0d 69 66 |nate mon|itor,.if|
|00000c20| 20 61 76 61 69 6c 61 62 | 6c 65 2e 20 46 69 78 65 | availab|le. Fixe|
|00000c30| 64 20 61 20 73 6d 61 6c | 6c 20 62 75 67 20 74 68 |d a smal|l bug th|
|00000c40| 61 74 20 70 72 65 76 65 | 6e 74 65 64 20 64 69 73 |at preve|nted dis|
|00000c50| 70 6c 61 79 20 6f 66 20 | 6e 6f 69 73 65 20 6f 6e |play of |noise on|
|00000c60| 20 61 6e 20 61 6c 74 65 | 72 6e 61 74 65 0d 6d 6f | an alte|rnate.mo|
|00000c70| 6e 69 74 6f 72 20 69 66 | 20 69 74 20 68 61 64 20 |nitor if| it had |
|00000c80| 61 20 64 69 66 66 65 72 | 65 6e 74 20 70 69 78 65 |a differ|ent pixe|
|00000c90| 6c 53 69 7a 65 20 74 68 | 61 6e 20 74 68 65 20 6d |lSize th|an the m|
|00000ca0| 61 69 6e 20 73 63 72 65 | 65 6e 2e 0d 0d 39 2f 31 |ain scre|en...9/1|
|00000cb0| 35 2f 39 32 20 64 67 70 | 20 55 70 64 61 74 65 64 |5/92 dgp| Updated|
|00000cc0| 20 74 6f 20 75 73 65 20 | 6e 65 77 20 54 69 6d 65 | to use |new Time|
|00000cd0| 72 2e 63 2e 0d 0d 32 2f | 31 38 2f 39 33 09 64 67 |r.c...2/|18/93.dg|
|00000ce0| 70 09 41 64 64 65 64 20 | 66 70 75 20 74 65 73 74 |p.Added |fpu test|
|00000cf0| 2e 0d 32 2f 32 30 2f 39 | 33 09 64 67 70 09 43 61 |..2/20/9|3.dgp.Ca|
|00000d00| 6c 6c 20 52 65 71 75 69 | 72 65 28 29 2c 20 69 6e |ll Requi|re(), in|
|00000d10| 63 72 65 61 73 65 64 20 | 73 74 61 63 6b 20 73 70 |creased |stack sp|
|00000d20| 61 63 65 2e 0d 2a 2f 0d | 0d 23 69 6e 63 6c 75 64 |ace..*/.|.#includ|
|00000d30| 65 20 22 56 69 64 65 6f | 54 6f 6f 6c 62 6f 78 2e |e "Video|Toolbox.|
|00000d40| 68 22 0d 23 69 66 20 54 | 48 49 4e 4b 5f 43 0d 09 |h".#if T|HINK_C..|
|00000d50| 23 69 6e 63 6c 75 64 65 | 20 3c 63 6f 6e 73 6f 6c |#include| <consol|
|00000d60| 65 2e 68 3e 0d 23 65 6e | 64 69 66 0d 0d 2f 2a 20 |e.h>.#en|dif../* |
|00000d70| 54 68 65 20 75 73 65 72 | 20 6d 61 79 20 77 69 73 |The user| may wis|
|00000d80| 68 20 74 6f 20 61 64 6a | 75 73 74 20 74 68 65 73 |h to adj|ust thes|
|00000d90| 65 2e 20 57 49 44 54 48 | 20 73 68 6f 75 6c 64 20 |e. WIDTH| should |
|00000da0| 62 65 20 61 20 6d 75 6c | 74 69 70 6c 65 20 6f 66 |be a mul|tiple of|
|00000db0| 20 34 2e 20 2a 2f 0d 23 | 64 65 66 69 6e 65 20 4d | 4. */.#|define M|
|00000dc0| 41 58 46 52 41 4d 45 53 | 09 32 30 30 09 09 2f 2f |AXFRAMES|.200..//|
|00000dd0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 66 72 61 6d 65 | number |of frame|
|00000de0| 73 20 69 6e 20 6d 6f 76 | 69 65 0d 23 64 65 66 69 |s in mov|ie.#defi|
|00000df0| 6e 65 20 57 49 44 54 48 | 09 32 35 36 09 09 09 2f |ne WIDTH|.256.../|
|00000e00| 2a 20 77 69 64 74 68 20 | 6f 66 20 64 69 73 70 6c |* width |of displ|
|00000e10| 61 79 65 64 20 6e 6f 69 | 73 65 20 6d 6f 76 69 65 |ayed noi|se movie|
|00000e20| 2c 20 69 6e 20 70 69 78 | 65 6c 73 20 2a 2f 0d 23 |, in pix|els */.#|
|00000e30| 64 65 66 69 6e 65 20 48 | 45 49 47 48 54 09 32 35 |define H|EIGHT.25|
|00000e40| 36 09 09 09 2f 2a 20 68 | 65 69 67 68 74 20 6f 66 |6.../* h|eight of|
|00000e50| 20 64 69 73 70 6c 61 79 | 65 64 20 6e 6f 69 73 65 | display|ed noise|
|00000e60| 20 6d 6f 76 69 65 2c 20 | 69 6e 20 70 69 78 65 6c | movie, |in pixel|
|00000e70| 73 20 2a 2f 0d 23 64 65 | 66 69 6e 65 20 52 41 4e |s */.#de|fine RAN|
|00000e80| 44 4f 4d 50 48 41 53 45 | 20 31 09 09 2f 2a 20 72 |DOMPHASE| 1../* r|
|00000e90| 61 6e 64 6f 6d 6c 79 20 | 73 68 69 66 74 20 65 61 |andomly |shift ea|
|00000ea0| 63 68 20 6d 6f 76 69 65 | 20 66 72 61 6d 65 20 2a |ch movie| frame *|
|00000eb0| 2f 0d 0d 2f 2a 20 54 68 | 69 73 20 69 73 20 6a 75 |/../* Th|is is ju|
|00000ec0| 73 74 20 66 6f 72 20 72 | 65 66 65 72 65 6e 63 65 |st for r|eference|
|00000ed0| 2e 20 54 68 65 20 6f 72 | 69 67 69 6e 61 6c 20 69 |. The or|iginal i|
|00000ee0| 73 20 69 6e 20 56 69 64 | 65 6f 54 6f 6f 6c 62 6f |s in Vid|eoToolbo|
|00000ef0| 78 2e 68 0d 73 74 72 75 | 63 74 20 56 42 4c 54 61 |x.h.stru|ct VBLTa|
|00000f00| 73 6b 41 6e 64 41 35 20 | 7b 0d 20 20 20 20 76 6f |skAndA5 |{. vo|
|00000f10| 6c 61 74 69 6c 65 20 56 | 42 4c 54 61 73 6b 20 76 |latile V|BLTask v|
|00000f20| 62 6c 3b 0d 20 20 20 20 | 6c 6f 6e 67 20 6f 75 72 |bl;. |long our|
|00000f30| 41 35 3b 0d 20 20 20 20 | 76 6f 69 64 20 28 2a 73 |A5;. |void (*s|
|00000f40| 75 62 72 6f 75 74 69 6e | 65 29 28 73 74 72 75 63 |ubroutin|e)(struc|
|00000f50| 74 20 56 42 4c 54 61 73 | 6b 41 6e 64 41 35 20 2a |t VBLTas|kAndA5 *|
|00000f60| 76 62 6c 44 61 74 61 29 | 3b 0d 20 20 20 20 47 44 |vblData)|;. GD|
|00000f70| 48 61 6e 64 6c 65 20 64 | 65 76 69 63 65 3b 0d 20 |Handle d|evice;. |
|00000f80| 20 20 20 6c 6f 6e 67 20 | 73 6c 6f 74 3b 0d 20 20 | long |slot;. |
|00000f90| 20 20 76 6f 6c 61 74 69 | 6c 65 20 6c 6f 6e 67 20 | volati|le long |
|00000fa0| 6e 65 77 46 72 61 6d 65 | 3b 09 09 09 09 2f 2f 20 |newFrame|;....// |
|00000fb0| 42 6f 6f 6c 65 61 6e 0d | 20 20 20 20 76 6f 6c 61 |Boolean.| vola|
|00000fc0| 74 69 6c 65 20 6c 6f 6e | 67 20 66 72 61 6d 65 73 |tile lon|g frames|
|00000fd0| 4c 65 66 74 3b 09 09 09 | 2f 2f 20 63 6f 75 6e 74 |Left;...|// count|
|00000fe0| 20 64 6f 77 6e 20 74 6f | 20 7a 65 72 6f 0d 20 20 | down to| zero. |
|00000ff0| 20 20 6c 6f 6e 67 20 66 | 72 61 6d 65 73 44 65 73 | long f|ramesDes|
|00001000| 69 72 65 64 3b 0d 20 20 | 20 20 76 6f 69 64 20 2a |ired;. | void *|
|00001010| 70 74 72 3b 09 09 09 09 | 09 09 09 2f 2f 20 75 73 |ptr;....|...// us|
|00001020| 65 20 74 68 69 73 20 66 | 6f 72 20 77 68 61 74 65 |e this f|or whate|
|00001030| 76 65 72 20 79 6f 75 20 | 77 61 6e 74 0d 7d 3b 0d |ver you |want.};.|
|00001040| 74 79 70 65 64 65 66 20 | 73 74 72 75 63 74 20 56 |typedef |struct V|
|00001050| 42 4c 54 61 73 6b 41 6e | 64 41 35 20 56 42 4c 54 |BLTaskAn|dA5 VBLT|
|00001060| 61 73 6b 41 6e 64 41 35 | 3b 0d 2a 2f 0d 0d 76 6f |askAndA5|;.*/..vo|
|00001070| 69 64 20 6d 61 69 6e 28 | 76 6f 69 64 29 3b 0d 0d |id main(|void);..|
|00001080| 76 6f 69 64 20 6d 61 69 | 6e 28 29 0d 7b 0d 09 69 |void mai|n().{..i|
|00001090| 6e 74 20 69 2c 6a 2c 65 | 72 72 6f 72 3b 0d 09 69 |nt i,j,e|rror;..i|
|000010a0| 6e 74 20 64 78 3d 33 32 | 2c 64 79 3d 33 32 2c 64 |nt dx=32|,dy=32,d|
|000010b0| 74 3d 31 2c 64 75 72 61 | 74 69 6f 6e 3b 0d 09 6c |t=1,dura|tion;..l|
|000010c0| 6f 6e 67 20 66 72 61 6d | 65 73 3b 0d 09 75 6e 73 |ong fram|es;..uns|
|000010d0| 69 67 6e 65 64 20 6c 6f | 6e 67 20 73 65 65 64 3b |igned lo|ng seed;|
|000010e0| 0d 09 64 6f 75 62 6c 65 | 20 73 3b 0d 09 73 74 61 |..double| s;..sta|
|000010f0| 74 69 63 20 63 68 61 72 | 20 73 74 72 69 6e 67 5b |tic char| string[|
|00001100| 36 34 5d 3b 0d 09 52 65 | 63 74 20 72 3b 0d 09 73 |64];..Re|ct r;..s|
|00001110| 68 6f 72 74 20 6e 6f 69 | 73 65 49 3d 30 2c 6e 6f |hort noi|seI=0,no|
|00001120| 69 73 65 4e 3d 4d 41 58 | 46 52 41 4d 45 53 3b 0d |iseN=MAX|FRAMES;.|
|00001130| 09 73 74 61 74 69 63 20 | 50 69 78 4d 61 70 20 6e |.static |PixMap n|
|00001140| 6f 69 73 65 49 6d 61 67 | 65 5b 4d 41 58 46 52 41 |oiseImag|e[MAXFRA|
|00001150| 4d 45 53 5d 3b 0d 09 73 | 74 61 74 69 63 20 73 68 |MES];..s|tatic sh|
|00001160| 6f 72 74 20 6e 6f 69 73 | 65 53 65 71 75 65 6e 63 |ort nois|eSequenc|
|00001170| 65 5b 4d 41 58 46 52 41 | 4d 45 53 5d 3b 20 2f 2a |e[MAXFRA|MES]; /*|
|00001180| 20 73 68 75 66 66 6c 65 | 64 20 73 65 71 75 65 6e | shuffle|d sequen|
|00001190| 63 65 20 2a 2f 0d 09 56 | 42 4c 54 61 73 6b 41 6e |ce */..V|BLTaskAn|
|000011a0| 64 41 35 20 6e 6f 69 73 | 65 56 42 4c 3b 0d 09 57 |dA5 nois|eVBL;..W|
|000011b0| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 2c |indowPtr| window,|
|000011c0| 6f 6c 64 50 6f 72 74 3b | 0d 09 45 76 65 6e 74 52 |oldPort;|..EventR|
|000011d0| 65 63 6f 72 64 20 74 68 | 65 45 76 65 6e 74 3b 0d |ecord th|eEvent;.|
|000011e0| 09 69 6e 74 20 66 72 61 | 6d 65 44 6f 6e 65 3b 0d |.int fra|meDone;.|
|000011f0| 09 54 69 6d 65 72 20 2a | 74 69 6d 65 72 3b 0d 09 |.Timer *|timer;..|
|00001200| 0d 09 53 74 61 63 6b 47 | 72 6f 77 28 31 30 30 30 |..StackG|row(1000|
|00001210| 30 29 3b 0d 09 52 65 71 | 75 69 72 65 28 67 65 73 |0);..Req|uire(ges|
|00001220| 74 61 6c 74 38 42 69 74 | 51 44 29 3b 0d 09 47 65 |talt8Bit|QD);..Ge|
|00001230| 74 44 61 74 65 54 69 6d | 65 28 26 73 65 65 64 29 |tDateTim|e(&seed)|
|00001240| 3b 0d 09 73 72 61 6e 64 | 28 73 65 65 64 29 3b 0d |;..srand|(seed);.|
|00001250| 09 2f 2a 20 49 4e 49 54 | 49 41 4c 49 5a 45 20 51 |./* INIT|IALIZE Q|
|00001260| 75 69 63 6b 44 72 61 77 | 20 2a 2f 0d 09 23 69 66 |uickDraw| */..#if|
|00001270| 20 54 48 49 4e 4b 5f 43 | 0d 09 09 63 6f 6e 73 6f | THINK_C|...conso|
|00001280| 6c 65 5f 6f 70 74 69 6f | 6e 73 2e 6e 72 6f 77 73 |le_optio|ns.nrows|
|00001290| 20 3d 20 33 3b 0d 09 09 | 70 72 69 6e 74 66 28 22 | = 3;...|printf("|
|000012a0| 5c 6e 22 29 3b 0d 09 23 | 65 6c 73 65 0d 09 09 49 |\n");..#|else...I|
|000012b0| 6e 69 74 47 72 61 66 28 | 28 50 74 72 29 20 26 74 |nitGraf(|(Ptr) &t|
|000012c0| 68 65 50 6f 72 74 29 3b | 0d 09 09 49 6e 69 74 46 |hePort);|...InitF|
|000012d0| 6f 6e 74 73 28 29 3b 0d | 09 09 49 6e 69 74 57 69 |onts();.|..InitWi|
|000012e0| 6e 64 6f 77 73 28 29 3b | 0d 09 09 49 6e 69 74 43 |ndows();|...InitC|
|000012f0| 75 72 73 6f 72 28 29 3b | 0d 09 23 65 6e 64 69 66 |ursor();|..#endif|
|00001300| 0d 0d 09 2f 2f 20 70 69 | 63 6b 20 61 20 73 63 72 |...// pi|ck a scr|
|00001310| 65 65 6e 0d 09 6e 6f 69 | 73 65 56 42 4c 2e 64 65 |een..noi|seVBL.de|
|00001320| 76 69 63 65 3d 47 65 74 | 53 63 72 65 65 6e 44 65 |vice=Get|ScreenDe|
|00001330| 76 69 63 65 28 31 29 3b | 0d 09 69 66 28 6e 6f 69 |vice(1);|..if(noi|
|00001340| 73 65 56 42 4c 2e 64 65 | 76 69 63 65 3d 3d 4e 55 |seVBL.de|vice==NU|
|00001350| 4c 4c 29 6e 6f 69 73 65 | 56 42 4c 2e 64 65 76 69 |LL)noise|VBL.devi|
|00001360| 63 65 3d 47 65 74 53 63 | 72 65 65 6e 44 65 76 69 |ce=GetSc|reenDevi|
|00001370| 63 65 28 30 29 3b 0d 0d | 09 70 72 69 6e 74 66 28 |ce(0);..|.printf(|
|00001380| 22 45 6e 74 65 72 20 77 | 69 64 74 68 20 6f 66 20 |"Enter w|idth of |
|00001390| 63 68 65 63 6b 20 69 6e | 20 70 69 78 65 6c 73 20 |check in| pixels |
|000013a0| 28 25 64 29 3f 22 2c 64 | 78 29 3b 0d 09 67 65 74 |(%d)?",d|x);..get|
|000013b0| 73 28 73 74 72 69 6e 67 | 29 3b 0d 09 73 73 63 61 |s(string|);..ssca|
|000013c0| 6e 66 28 73 74 72 69 6e | 67 2c 22 25 64 22 2c 26 |nf(strin|g,"%d",&|
|000013d0| 64 78 29 3b 0d 09 70 72 | 69 6e 74 66 28 22 25 64 |dx);..pr|intf("%d|
|000013e0| 5c 6e 22 2c 64 78 29 3b | 0d 09 70 72 69 6e 74 66 |\n",dx);|..printf|
|000013f0| 28 22 45 6e 74 65 72 20 | 68 65 69 67 68 74 20 6f |("Enter |height o|
|00001400| 66 20 63 68 65 63 6b 20 | 69 6e 20 70 69 78 65 6c |f check |in pixel|
|00001410| 73 20 28 25 64 29 3f 22 | 2c 64 79 29 3b 0d 09 67 |s (%d)?"|,dy);..g|
|00001420| 65 74 73 28 73 74 72 69 | 6e 67 29 3b 0d 09 73 73 |ets(stri|ng);..ss|
|00001430| 63 61 6e 66 28 73 74 72 | 69 6e 67 2c 22 25 64 22 |canf(str|ing,"%d"|
|00001440| 2c 26 64 79 29 3b 0d 09 | 70 72 69 6e 74 66 28 22 |,&dy);..|printf("|
|00001450| 25 64 5c 6e 22 2c 64 79 | 29 3b 0d 09 70 72 69 6e |%d\n",dy|);..prin|
|00001460| 74 66 28 22 45 6e 74 65 | 72 20 64 75 72 61 74 69 |tf("Ente|r durati|
|00001470| 6f 6e 20 6f 66 20 63 68 | 65 63 6b 20 69 6e 20 66 |on of ch|eck in f|
|00001480| 72 61 6d 65 73 20 28 25 | 64 29 3f 22 2c 64 74 29 |rames (%|d)?",dt)|
|00001490| 3b 0d 09 67 65 74 73 28 | 73 74 72 69 6e 67 29 3b |;..gets(|string);|
|000014a0| 0d 09 73 73 63 61 6e 66 | 28 73 74 72 69 6e 67 2c |..sscanf|(string,|
|000014b0| 22 25 64 22 2c 26 64 74 | 29 3b 0d 09 70 72 69 6e |"%d",&dt|);..prin|
|000014c0| 74 66 28 22 25 64 5c 6e | 22 2c 64 74 29 3b 0d 0d |tf("%d\n|",dt);..|
|000014d0| 09 47 65 74 50 6f 72 74 | 28 26 6f 6c 64 50 6f 72 |.GetPort|(&oldPor|
|000014e0| 74 29 3b 0d 09 53 65 74 | 52 65 63 74 28 26 72 2c |t);..Set|Rect(&r,|
|000014f0| 30 2c 30 2c 57 49 44 54 | 48 2c 57 49 44 54 48 29 |0,0,WIDT|H,WIDTH)|
|00001500| 3b 0d 09 43 65 6e 74 65 | 72 52 65 63 74 49 6e 52 |;..Cente|rRectInR|
|00001510| 65 63 74 28 26 72 2c 26 | 28 2a 6e 6f 69 73 65 56 |ect(&r,&|(*noiseV|
|00001520| 42 4c 2e 64 65 76 69 63 | 65 29 2d 3e 67 64 52 65 |BL.devic|e)->gdRe|
|00001530| 63 74 29 3b 0d 09 4f 66 | 66 73 65 74 52 65 63 74 |ct);..Of|fsetRect|
|00001540| 28 26 72 2c 2d 28 72 2e | 6c 65 66 74 25 33 32 29 |(&r,-(r.|left%32)|
|00001550| 2c 30 29 3b 0d 09 77 69 | 6e 64 6f 77 3d 4e 65 77 |,0);..wi|ndow=New|
|00001560| 43 57 69 6e 64 6f 77 28 | 4e 55 4c 4c 2c 26 72 2c |CWindow(|NULL,&r,|
|00001570| 22 5c 70 43 6f 6d 70 75 | 74 69 6e 67 20 6e 6f 69 |"\pCompu|ting noi|
|00001580| 73 65 20 2e 2e 2e 22 2c | 31 2c 6e 6f 47 72 6f 77 |se ...",|1,noGrow|
|00001590| 44 6f 63 50 72 6f 63 2c | 28 57 69 6e 64 6f 77 50 |DocProc,|(WindowP|
|000015a0| 74 72 29 20 2d 31 4c 2c | 30 2c 30 4c 29 3b 0d 09 |tr) -1L,|0,0L);..|
|000015b0| 53 65 74 50 6f 72 74 28 | 77 69 6e 64 6f 77 29 3b |SetPort(|window);|
|000015c0| 0d 09 66 6f 72 28 69 3d | 30 3b 69 3c 4d 41 58 46 |..for(i=|0;i<MAXF|
|000015d0| 52 41 4d 45 53 3b 69 2b | 2b 29 7b 0d 09 09 6e 6f |RAMES;i+|+){...no|
|000015e0| 69 73 65 49 6d 61 67 65 | 5b 69 5d 2e 70 69 78 65 |iseImage|[i].pixe|
|000015f0| 6c 53 69 7a 65 3d 28 2a | 2a 28 2a 2a 47 65 74 57 |lSize=(*|*(**GetW|
|00001600| 69 6e 64 6f 77 44 65 76 | 69 63 65 28 77 69 6e 64 |indowDev|ice(wind|
|00001610| 6f 77 29 29 2e 67 64 50 | 4d 61 70 29 2e 70 69 78 |ow)).gdP|Map).pix|
|00001620| 65 6c 53 69 7a 65 3b 0d | 09 09 6e 6f 69 73 65 49 |elSize;.|..noiseI|
|00001630| 6d 61 67 65 5b 69 5d 2e | 62 6f 75 6e 64 73 3d 77 |mage[i].|bounds=w|
|00001640| 69 6e 64 6f 77 2d 3e 70 | 6f 72 74 52 65 63 74 3b |indow->p|ortRect;|
|00001650| 0d 09 09 6e 6f 69 73 65 | 49 6d 61 67 65 5b 69 5d |...noise|Image[i]|
|00001660| 2e 62 61 73 65 41 64 64 | 72 3d 4e 55 4c 4c 3b 0d |.baseAdd|r=NULL;.|
|00001670| 09 09 65 72 72 6f 72 3d | 4d 61 6b 65 4e 6f 69 73 |..error=|MakeNois|
|00001680| 65 31 28 64 78 2c 64 79 | 2c 52 41 4e 44 4f 4d 50 |e1(dx,dy|,RANDOMP|
|00001690| 48 41 53 45 2c 26 6e 6f | 69 73 65 49 6d 61 67 65 |HASE,&no|iseImage|
|000016a0| 5b 69 5d 29 3b 0d 09 09 | 69 66 28 65 72 72 6f 72 |[i]);...|if(error|
|000016b0| 29 62 72 65 61 6b 3b 0d | 09 7d 0d 09 6e 6f 69 73 |)break;.|.}..nois|
|000016c0| 65 4e 3d 69 3b 0d 09 53 | 65 74 50 6f 72 74 28 6f |eN=i;..S|etPort(o|
|000016d0| 6c 64 50 6f 72 74 29 3b | 0d 09 70 72 69 6e 74 66 |ldPort);|..printf|
|000016e0| 28 22 55 73 69 6e 67 20 | 25 64 20 64 69 66 66 65 |("Using |%d diffe|
|000016f0| 72 65 6e 74 20 66 72 61 | 6d 65 73 20 6f 66 20 6e |rent fra|mes of n|
|00001700| 6f 69 73 65 2e 5c 6e 22 | 2c 6e 6f 69 73 65 4e 29 |oise.\n"|,noiseN)|
|00001710| 3b 0d 09 66 6f 72 28 69 | 3d 30 3b 69 3c 6e 6f 69 |;..for(i|=0;i<noi|
|00001720| 73 65 4e 3b 69 2b 2b 29 | 6e 6f 69 73 65 53 65 71 |seN;i++)|noiseSeq|
|00001730| 75 65 6e 63 65 5b 69 5d | 3d 69 3b 20 2f 2a 20 69 |uence[i]|=i; /* i|
|00001740| 6e 69 74 69 61 6c 69 7a | 65 20 73 65 71 75 65 6e |nitializ|e sequen|
|00001750| 63 65 20 2a 2f 0d 09 46 | 6c 75 73 68 45 76 65 6e |ce */..F|lushEven|
|00001760| 74 73 28 2d 31 4c 2c 30 | 29 3b 0d 09 70 72 69 6e |ts(-1L,0|);..prin|
|00001770| 74 66 28 22 48 69 74 20 | 61 6e 79 20 6b 65 79 20 |tf("Hit |any key |
|00001780| 74 6f 20 71 75 69 74 2e | 5c 6e 22 29 3b 0d 09 53 |to quit.|\n");..S|
|00001790| 65 74 57 54 69 74 6c 65 | 28 77 69 6e 64 6f 77 2c |etWTitle|(window,|
|000017a0| 22 5c 70 4e 6f 69 73 65 | 56 42 4c 22 29 3b 0d 09 |"\pNoise|VBL");..|
|000017b0| 74 69 6d 65 72 3d 4e 65 | 77 54 69 6d 65 72 28 29 |timer=Ne|wTimer()|
|000017c0| 3b 0d 09 64 6f 7b 0d 09 | 09 53 65 6c 65 63 74 57 |;..do{..|.SelectW|
|000017d0| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 3b 0d 09 |indow(wi|ndow);..|
|000017e0| 09 53 68 75 66 66 6c 65 | 28 6e 6f 69 73 65 53 65 |.Shuffle|(noiseSe|
|000017f0| 71 75 65 6e 63 65 2c 6e | 6f 69 73 65 4e 29 3b 09 |quence,n|oiseN);.|
|00001800| 2f 2a 20 73 68 75 66 66 | 6c 65 20 74 68 65 20 69 |/* shuff|le the i|
|00001810| 6d 61 67 65 73 20 2a 2f | 0d 09 09 6e 6f 69 73 65 |mages */|...noise|
|00001820| 49 3d 30 3b 0d 09 09 6e | 6f 69 73 65 56 42 4c 2e |I=0;...n|oiseVBL.|
|00001830| 73 75 62 72 6f 75 74 69 | 6e 65 3d 4e 55 4c 4c 3b |subrouti|ne=NULL;|
|00001840| 09 2f 2f 20 75 73 65 20 | 64 65 66 61 75 6c 74 0d |.// use |default.|
|00001850| 09 09 65 72 72 6f 72 3d | 56 42 4c 49 6e 73 74 61 |..error=|VBLInsta|
|00001860| 6c 6c 28 26 6e 6f 69 73 | 65 56 42 4c 2c 6e 6f 69 |ll(&nois|eVBL,noi|
|00001870| 73 65 56 42 4c 2e 64 65 | 76 69 63 65 2c 4d 41 58 |seVBL.de|vice,MAX|
|00001880| 46 52 41 4d 45 53 29 3b | 0d 09 09 69 66 28 65 72 |FRAMES);|...if(er|
|00001890| 72 6f 72 29 50 72 69 6e | 74 66 45 78 69 74 28 22 |ror)Prin|tfExit("|
|000018a0| 56 42 4c 49 6e 73 74 61 | 6c 6c 3a 20 65 72 72 6f |VBLInsta|ll: erro|
|000018b0| 72 20 25 64 5c 6e 22 2c | 65 72 72 6f 72 29 3b 0d |r %d\n",|error);.|
|000018c0| 09 09 6e 6f 69 73 65 56 | 42 4c 2e 76 62 6c 2e 76 |..noiseV|BL.vbl.v|
|000018d0| 62 6c 43 6f 75 6e 74 3d | 31 3b 09 2f 2f 20 45 6e |blCount=|1;.// En|
|000018e0| 61 62 6c 65 20 69 6e 74 | 65 72 72 75 70 74 20 73 |able int|errupt s|
|000018f0| 65 72 76 69 63 65 20 72 | 6f 75 74 69 6e 65 0d 09 |ervice r|outine..|
|00001900| 09 77 68 69 6c 65 28 21 | 6e 6f 69 73 65 56 42 4c |.while(!|noiseVBL|
|00001910| 2e 6e 65 77 46 72 61 6d | 65 29 3b 09 2f 2f 20 77 |.newFram|e);.// w|
|00001920| 61 69 74 20 66 6f 72 20 | 66 69 72 73 74 20 66 72 |ait for |first fr|
|00001930| 61 6d 65 0d 09 09 6e 6f | 69 73 65 56 42 4c 2e 6e |ame...no|iseVBL.n|
|00001940| 65 77 46 72 61 6d 65 3d | 30 3b 0d 09 09 77 68 69 |ewFrame=|0;...whi|
|00001950| 6c 65 28 21 6e 6f 69 73 | 65 56 42 4c 2e 6e 65 77 |le(!nois|eVBL.new|
|00001960| 46 72 61 6d 65 29 3b 09 | 2f 2f 20 77 61 69 74 20 |Frame);.|// wait |
|00001970| 66 6f 72 20 73 65 63 6f | 6e 64 20 66 72 61 6d 65 |for seco|nd frame|
|00001980| 0d 09 09 53 74 61 72 74 | 54 69 6d 65 72 28 74 69 |...Start|Timer(ti|
|00001990| 6d 65 72 29 3b 0d 09 09 | 66 72 61 6d 65 73 3d 6e |mer);...|frames=n|
|000019a0| 6f 69 73 65 56 42 4c 2e | 66 72 61 6d 65 73 4c 65 |oiseVBL.|framesLe|
|000019b0| 66 74 3b 0d 09 09 77 68 | 69 6c 65 28 6e 6f 69 73 |ft;...wh|ile(nois|
|000019c0| 65 56 42 4c 2e 66 72 61 | 6d 65 73 4c 65 66 74 3e |eVBL.fra|mesLeft>|
|000019d0| 31 29 7b 0d 09 09 09 69 | 66 28 6e 6f 69 73 65 56 |1){....i|f(noiseV|
|000019e0| 42 4c 2e 6e 65 77 46 72 | 61 6d 65 29 7b 0d 09 09 |BL.newFr|ame){...|
|000019f0| 09 09 6e 6f 69 73 65 56 | 42 4c 2e 6e 65 77 46 72 |..noiseV|BL.newFr|
|00001a00| 61 6d 65 3d 30 3b 0d 09 | 09 09 09 43 6f 70 79 42 |ame=0;..|...CopyB|
|00001a10| 69 74 73 51 75 69 63 6b | 6c 79 28 28 42 69 74 4d |itsQuick|ly((BitM|
|00001a20| 61 70 20 2a 29 26 28 6e | 6f 69 73 65 49 6d 61 67 |ap *)&(n|oiseImag|
|00001a30| 65 5b 6e 6f 69 73 65 53 | 65 71 75 65 6e 63 65 5b |e[noiseS|equence[|
|00001a40| 6e 6f 69 73 65 49 5d 5d | 29 0d 09 09 09 09 09 2c |noiseI]]|)......,|
|00001a50| 28 42 69 74 4d 61 70 20 | 2a 29 2a 28 28 43 47 72 |(BitMap |*)*((CGr|
|00001a60| 61 66 50 74 72 29 77 69 | 6e 64 6f 77 29 2d 3e 70 |afPtr)wi|ndow)->p|
|00001a70| 6f 72 74 50 69 78 4d 61 | 70 0d 09 09 09 09 09 2c |ortPixMa|p......,|
|00001a80| 26 6e 6f 69 73 65 49 6d | 61 67 65 5b 30 5d 2e 62 |&noiseIm|age[0].b|
|00001a90| 6f 75 6e 64 73 2c 26 77 | 69 6e 64 6f 77 2d 3e 70 |ounds,&w|indow->p|
|00001aa0| 6f 72 74 52 65 63 74 2c | 73 72 63 43 6f 70 79 2c |ortRect,|srcCopy,|
|00001ab0| 4e 55 4c 4c 29 3b 0d 09 | 09 09 09 69 66 28 6e 6f |NULL);..|...if(no|
|00001ac0| 69 73 65 56 42 4c 2e 66 | 72 61 6d 65 73 4c 65 66 |iseVBL.f|ramesLef|
|00001ad0| 74 25 64 74 3d 3d 30 29 | 7b 0d 09 09 09 09 09 6e |t%dt==0)|{......n|
|00001ae0| 6f 69 73 65 49 2b 2b 3b | 0d 09 09 09 09 09 69 66 |oiseI++;|......if|
|00001af0| 28 6e 6f 69 73 65 49 3e | 3d 6e 6f 69 73 65 4e 29 |(noiseI>|=noiseN)|
|00001b00| 20 7b 0d 09 09 09 09 09 | 09 53 68 75 66 66 6c 65 | {......|.Shuffle|
|00001b10| 28 6e 6f 69 73 65 53 65 | 71 75 65 6e 63 65 2c 6e |(noiseSe|quence,n|
|00001b20| 6f 69 73 65 4e 29 3b 0d | 09 09 09 09 09 09 6e 6f |oiseN);.|......no|
|00001b30| 69 73 65 49 3d 30 3b 0d | 09 09 09 09 09 7d 0d 09 |iseI=0;.|.....}..|
|00001b40| 09 09 09 7d 0d 09 09 09 | 7d 0d 09 09 7d 0d 09 09 |...}....|}...}...|
|00001b50| 77 68 69 6c 65 28 21 6e | 6f 69 73 65 56 42 4c 2e |while(!n|oiseVBL.|
|00001b60| 6e 65 77 46 72 61 6d 65 | 29 3b 09 2f 2f 20 77 61 |newFrame|);.// wa|
|00001b70| 69 74 20 66 6f 72 20 6c | 61 73 74 20 66 72 61 6d |it for l|ast fram|
|00001b80| 65 0d 09 09 73 3d 53 74 | 6f 70 54 69 6d 65 72 28 |e...s=St|opTimer(|
|00001b90| 74 69 6d 65 72 29 2f 31 | 30 30 30 30 30 30 2e 3b |timer)/1|000000.;|
|00001ba0| 0d 09 09 66 72 61 6d 65 | 73 2d 3d 6e 6f 69 73 65 |...frame|s-=noise|
|00001bb0| 56 42 4c 2e 66 72 61 6d | 65 73 4c 65 66 74 3b 0d |VBL.fram|esLeft;.|
|00001bc0| 09 09 56 42 4c 52 65 6d | 6f 76 65 28 26 6e 6f 69 |..VBLRem|ove(&noi|
|00001bd0| 73 65 56 42 4c 29 3b 0d | 09 09 70 72 69 6e 74 66 |seVBL);.|..printf|
|00001be0| 28 22 25 2e 31 66 20 48 | 7a 20 5c 72 22 2c 66 72 |("%.1f H|z \r",fr|
|00001bf0| 61 6d 65 73 2f 73 29 3b | 0d 09 7d 77 68 69 6c 65 |ames/s);|..}while|
|00001c00| 28 21 47 65 74 4e 65 78 | 74 45 76 65 6e 74 28 6b |(!GetNex|tEvent(k|
|00001c10| 65 79 44 6f 77 6e 2b 6b | 65 79 55 70 2b 6d 6f 75 |eyDown+k|eyUp+mou|
|00001c20| 73 65 44 6f 77 6e 2c 26 | 74 68 65 45 76 65 6e 74 |seDown,&|theEvent|
|00001c30| 29 29 3b 0d 09 46 6c 75 | 73 68 45 76 65 6e 74 73 |));..Flu|shEvents|
|00001c40| 28 2d 31 4c 2c 30 29 3b | 0d 09 66 6f 72 20 28 69 |(-1L,0);|..for (i|
|00001c50| 3d 30 3b 69 3c 6e 6f 69 | 73 65 4e 3b 69 2b 2b 29 |=0;i<noi|seN;i++)|
|00001c60| 20 44 69 73 70 6f 73 50 | 74 72 28 28 50 74 72 29 | DisposP|tr((Ptr)|
|00001c70| 20 6e 6f 69 73 65 49 6d | 61 67 65 5b 69 5d 2e 62 | noiseIm|age[i].b|
|00001c80| 61 73 65 41 64 64 72 29 | 3b 0d 09 44 69 73 70 6f |aseAddr)|;..Dispo|
|00001c90| 73 65 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 29 |seWindow|(window)|
|00001ca0| 3b 0d 09 44 69 73 70 6f | 73 65 54 69 6d 65 72 28 |;..Dispo|seTimer(|
|00001cb0| 74 69 6d 65 72 29 3b 0d | 09 61 62 6f 72 74 28 29 |timer);.|.abort()|
|00001cc0| 3b 0d 7d 0d 00 00 00 00 | 00 00 00 00 00 00 00 00 |;.}.....|........|
|00001cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001d00| 00 00 01 00 00 00 01 9c | 00 00 00 9c 00 00 00 5e |........|.......^|
|00001d10| 00 00 2c 72 00 00 00 ec | 05 00 00 00 2c 76 00 00 |..,r....|....,v..|
|00001d20| 00 ed 05 00 00 00 2c 7a | 00 00 00 ee 05 00 00 00 |......,z|........|
|00001d30| 0a 4e 6f 69 73 65 56 42 | 4c 2e 63 65 02 00 00 00 |.NoiseVB|L.ce....|
|00001d40| 54 45 58 54 4b 41 48 4c | 00 00 00 00 00 00 00 00 |TEXTKAHL|........|
|00001d50| 00 00 54 45 58 54 4b 41 | 48 4c 00 00 00 00 00 00 |..TEXTKA|HL......|
|00001d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001d70| 00 00 a7 e5 d5 81 00 00 | 00 00 00 00 01 fa 00 00 |........|........|
|00001d80| 2c 9e 00 00 00 f7 05 00 | 00 00 2c a2 00 00 00 f8 |,.......|..,.....|
|00001d90| 05 00 00 00 2c a6 00 00 | 00 f9 05 00 00 00 2c aa |....,...|......,.|
|00001da0| 00 00 00 fa 05 00 00 00 | 2c ae 00 00 00 fb 05 00 |........|,.......|
|00001db0| 00 00 2c b2 00 00 00 fc | 05 00 00 00 2c b6 00 00 |..,.....|....,...|
|00001dc0| 00 fd 05 00 00 00 2c ba | 00 00 08 dd 05 00 00 00 |......,.|........|
|00001dd0| 2d 03 00 00 09 25 05 00 | 00 00 2d 0f 00 00 09 3e |-....%..|..-....>|
|00001de0| 05 00 00 00 2d 18 00 00 | 09 3f 05 00 00 00 2d 1c |....-...|.?....-.|
|00001df0| 00 00 09 40 05 00 00 00 | 2d 20 00 00 09 41 05 00 |...@....|- ...A..|
|00001e00| 00 00 00 14 00 00 19 11 | ff ff 00 00 00 00 00 00 |........|........|
|00001e10| 1b 02 00 bc 00 00 00 00 | 00 00 00 2e 00 02 00 14 |........|........|
|00001e20| 00 00 1c 44 00 c7 00 00 | 00 00 10 02 05 6d 79 41 |...D....|.....myA|
|00001e30| 35 20 00 18 00 00 17 42 | 00 9f 00 00 00 00 00 00 |5 .....B|........|
|00001e40| 09 63 75 72 72 65 6e 74 | 41 35 00 00 00 14 00 00 |.current|A5......|
|00001e50| 1b 58 00 bf 00 00 00 00 | 00 00 14 50 00 8a 00 00 |.X......|...P....|
|00001e60| 00 00 00 00 00 36 00 02 | 00 14 00 00 18 09 00 a5 |.....6..|........|
|00001e70| 00 53 33 b0 00 00 05 65 | 72 72 6f 72 00 20 00 00 |.S3....e|rror. ..|
|00001e80| 18 cb 00 a9 00 53 33 6c | 00 00 11 6e 6f 69 73 65 |.....S3l|...noise|
|00001e90| 56 42 4c 2e 6e 65 77 46 | 72 61 6d 65 00 00 01 00 |VBL.newF|rame....|
|00001ea0| 00 00 01 9c 00 00 00 9c | 00 00 00 5e 00 f3 bf dc |........|...^....|
|00001eb0| 20 b0 00 00 00 1c 00 5e | 00 01 42 4b 50 54 00 01 | ......^|..BKPT..|
|00001ec0| 00 12 44 54 56 55 00 01 | 00 2a 20 b1 ff ff 00 00 |..DTVU..|.* .....|
|00001ed0| 00 00 00 00 00 00 2f d2 | ff ff 00 00 00 4a 00 00 |....../.|.....J..|
|00001ee0| 00 00 65 df ff ff 00 00 | 00 18 00 00 00 00 32 1c |..e.....|......2.|
|00001ef0| ff ff 00 00 00 62 00 00 | 00 00 00 00 00 00 00 00 |.....b..|........|
+--------+-------------------------+-------------------------+--------+--------+